<script lang="ts" setup name="CheckBody">
import {getCheckBody, saveCheckBody, rejectCheckBody, CheckBody, CheckBodyParams} from '@/api/medicalExaminerDesk/beginPhysicalExamination/checkBody'
import {ElMessage, FormRules} from 'element-plus'
import useUser from '@/store/user'
import {onMounted, reactive, ref, computed} from 'vue'
import {ChecksOrRadios, fieldRequired} from '@/api/medicalExaminerDesk/beginPhysicalExamination'
import {NotLeadingAndTrailingSpaces} from '@/util/common'
import {showMessageBox} from '@/util/element'
const user = useUser.setup().store

const props = defineProps({
  // 体检登记表id
  checkupRegisterId: {
    type: String,
    required: true,
    default: ''
  },
  // 禁止编辑
  disEdit: {
    type: Boolean,
    required: true,
    default: false
  },
  // 性别
  gender: {
    type: String,
    required: false,
    default: ''
  }
})

// 默认值
const initialForm: CheckBody = {
  eyeGroundState: '1', // 眼底
  skinState: '1', // 皮肤
  cornOpacState: '1', // 巩膜
  lympGlanState: '1', // 淋巴结
  barrelChestState: '1', // 肺-桶装肺
  breathSoundState: '1', // 肺-呼吸音
  raleState: '1', // 肺-罗音
  rhythmState: '1', // 心脏-心律
  murmurState: '1', // 心脏-杂音
  tendernessState: '1', // 腹部-压痛
  massState: '1', // 腹部-包块
  hapaState: '1', // 腹部-肝大
  spleState: '1', //  腹部-脾大
  shiftDullState: '1', // 腹部-移动性浊音
  edemaExtrState: '1', // 下肢水肿
  arteState: '1', // 足背动脉搏动
  digtExamState: '1', // 肛门指诊
  breast: '1', // 乳腺
  breastCheckboxs: ['1'], // 乳腺复选
  vulvaState: '1', // 外阴
  vaginoState: '1', //阴道
  cervicalState: '1', // 宫颈
  palaceState: '1', // 宫体
  annexaUteriState: '1' // 附件
}

// 查体表单
const checkBodyForm = reactive<CheckBody>({...initialForm})

// 表单实例
const formRef = ref()

// 保存和拒检的加载
const showSaveLoading = ref<boolean>(false)

// 体检大类的体检医生姓名,体检医生(没有医生时，岗位为医生才能显示自己的名字)
const dutyDoctorName4 = computed(() => {
  return checkBodyForm.dutyDoctorName || (user.userInfor?.jobName === '医生' ? user.userInfor?.userName : '')
})

// 体检状态
const checkupStatus4 = computed(() => {
  return checkBodyForm.checkupStatus
})

// 2、皮肤
const skinStateRadios: Array<ChecksOrRadios> = [
  {label: '正常', value: '1'},
  {label: '潮红', value: '2'},
  {label: '苍白', value: '3'},
  {label: '发绀', value: '4'},
  {label: '黄染', value: '5'},
  {label: '色素沉着', value: '6'},
  {label: '其他', value: '7'}
]

// 3、巩膜
const cornOpacStateRadios: Array<ChecksOrRadios> = [
  {label: '正常', value: '1'},
  {label: '黄染', value: '2'},
  {label: '充血', value: '3'},
  {label: '其他', value: '4'}
]

// 4、淋巴结
const lympGlanStateRadios: Array<ChecksOrRadios> = [
  {label: '未触及', value: '1'},
  {label: '锁骨上', value: '2'},
  {label: '腋窝', value: '3'},
  {label: '其他', value: '4'}
]

// 罗音
const raleStateRadios: Array<ChecksOrRadios> = [
  {label: '无', value: '1'},
  {label: '干罗音', value: '2'},
  {label: '湿罗音', value: '3'},
  {label: '其他', value: '4'}
]
// 8、下肢水肿
const edemaExtrStateRadios: Array<ChecksOrRadios> = [
  {label: '无', value: '1'},
  {label: '单侧', value: '2'},
  {label: '双侧不对称', value: '3'},
  {label: '双侧对称', value: '4'}
]
// 9、足背动脉搏动
const arteStateRadios: Array<ChecksOrRadios> = [
  {label: '未触及', value: '1'},
  {label: '触及双侧对称', value: '2'},
  {label: '触及左侧弱或消失', value: '3'},
  {label: '触及右侧弱或消失', value: '4'}
]
// 10、肛门指诊
const digtExamStateRadios: Array<ChecksOrRadios> = [
  {label: '未见异常', value: '1'},
  {label: '触痛', value: '2'},
  {label: '包块', value: '3'},
  {label: '前列腺异常', value: '4'},
  {label: '其他', value: '5'}
]

const breastCheckboxs: Array<ChecksOrRadios> = [
  {label: '未见异常', value: '1'},
  {label: '乳房切除', value: '2'},
  {label: '异常泌乳', value: '3'},
  {label: '乳腺包块', value: '4'},
  {label: '其他', value: '5'}
]

// 表单校验规则
const rules = computed<FormRules>(() => {
  return {
    // 眼底
    eyeGroundState: [{required: fieldRequired('eyeGroundState'), message: '请选择眼底!', trigger: ['change', 'blur']}],
    // 眼底异常
    eyeGroundStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 皮肤
    skinState: [{required: fieldRequired('skinState'), message: '请选择皮肤!', trigger: ['change', 'blur']}],
    // 其他皮肤
    skinStateOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 巩膜
    cornOpacState: [{required: fieldRequired('cornOpacState'), message: '请选择巩膜!', trigger: ['change', 'blur']}],
    // 其他巩膜
    cornOpacStateOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 淋巴结
    lympGlanState: [{required: fieldRequired('lympGlanState'), message: '请选择淋巴结!', trigger: ['change', 'blur']}],
    // 其他淋巴结
    lympGlanStateOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 桶状胸
    barrelChestState: [{required: fieldRequired('barrelChestState'), message: '请选择桶状胸!', trigger: ['change', 'blur']}],
    // 呼吸音
    breathSoundState: [{required: fieldRequired('breathSoundState'), message: '请选择呼吸音!', trigger: ['change', 'blur']}],
    // 罗音
    raleState: [{required: fieldRequired('raleState'), message: '请选择罗音!', trigger: ['change', 'blur']}],
    // 肺-呼吸音异常信息
    breathSoundStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 肺-其他罗音
    raleStateOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 心率
    heartRate: [{required: fieldRequired('heartRate'), message: '请输入心率!', trigger: ['change', 'blur']}],
    // 心律
    rhythmState: [{required: fieldRequired('rhythmState'), message: '请选择心律!', trigger: ['change', 'blur']}],
    // 杂音
    murmurState: [{required: fieldRequired('murmurState'), message: '请选择杂音!', trigger: ['change', 'blur']}],
    // 杂音信息
    murmurStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 压痛
    tendernessState: [{required: fieldRequired('tendernessState'), message: '请选择压痛!', trigger: ['change', 'blur']}],
    // 压痛信息
    tendernessStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 包块
    massState: [{required: fieldRequired('massState'), message: '请选择包块!', trigger: ['change', 'blur']}],
    // 包块信息
    massStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 肝大
    hapaState: [{required: fieldRequired('hapaState'), message: '请选择肝大!', trigger: ['change', 'blur']}],
    // 肝大信息
    hapaStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 脾大
    spleState: [{required: fieldRequired('spleState'), message: '请选择脾大!', trigger: ['change', 'blur']}],
    // 脾大信息
    spleStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 移动性浊音
    shiftDullState: [{required: fieldRequired('shiftDullState'), message: '请选择移动性浊音!', trigger: ['change', 'blur']}],
    // 移动性浊音信息
    shiftDullStateExist: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 下肢水肿
    edemaExtrState: [{required: fieldRequired('edemaExtrState'), message: '请选择下肢水肿!', trigger: ['change', 'blur']}],
    // 足背动脉搏动
    arteState: [{required: fieldRequired('arteState'), message: '请选择足背动脉搏动!', trigger: ['change', 'blur']}],
    // 肛门指诊
    digtExamState: [{required: fieldRequired('digtExamState'), message: '请选择肛门指诊!', trigger: ['change', 'blur']}],
    // 肛门指诊其他信息
    digtExamStateOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    breastCheckboxs: [{required: fieldRequired('breast'), message: '请选择乳腺!', trigger: ['change', 'blur']}],
    // 其他乳腺
    breastOthers: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 20, message: '最多20个字符！', trigger: ['change', 'blur']}
    ],
    // 外阴
    vulvaState: [{required: fieldRequired('vulvaState'), message: '请选择外阴!', trigger: ['change', 'blur']}],
    // 外阴异常信息
    vulvaStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 阴道
    vaginoState: [{required: fieldRequired('vaginoState'), message: '请选择阴道!', trigger: ['change', 'blur']}],
    // 阴道异常信息
    vaginoStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 宫颈
    cervicalState: [{required: fieldRequired('cervicalState'), message: '请选择宫颈!', trigger: ['change', 'blur']}],
    // 宫颈异常信息
    cervicalStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 宫体
    palaceState: [{required: fieldRequired('palaceState'), message: '请选择宫体!', trigger: ['change', 'blur']}],
    // 宫体异常信息
    palaceStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 附件
    annexaUteriState: [{required: fieldRequired('annexaUteriState'), message: '请选择附件!', trigger: ['change', 'blur']}],
    // 附件异常信息
    annexaUteriStateAbnormal: [
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 40, message: '最多40个字符！', trigger: ['change', 'blur']}
    ],
    // 查体其他
    bodyOther: [
      {required: fieldRequired('bodyOther'), message: '请输入查体其他!', trigger: ['blur']},
      {pattern: NotLeadingAndTrailingSpaces, message: '首尾不能为空格！', trigger: ['change', 'blur']},
      {max: 200, message: '最多200个字符！', trigger: ['change', 'blur']}
    ]
  }
})

/**
 * @description: 获取体检信息
 * @return {*}
 */
const getInitData = () => {
  props.checkupRegisterId &&
    getCheckBody(props.checkupRegisterId)
      .then((res) => {
        const {data} = res.data
        // 浅拷贝
        Object.assign(checkBodyForm, data)
        // 没有值的赋上默认值
        Object.keys(checkBodyForm)?.forEach((key) => {
          Object.keys(initialForm)?.forEach((initKey) => {
            !checkBodyForm[key] && key === initKey && (checkBodyForm[key] = initialForm[initKey])
          })
        })
        checkBodyForm.breastCheckboxs = data?.breast?.split('|') || ['1']
      })
      .finally(() => {
        showSaveLoading.value = false
        formRef.value?.clearValidate()
      })
}

// 表单参数
const formDataParams = computed<CheckBodyParams>(() => {
  return {
    eyeGroundState: checkBodyForm.eyeGroundState, // 眼底
    eyeGroundStateAbnormal: checkBodyForm.eyeGroundState === '2' ? checkBodyForm.eyeGroundStateAbnormal : null, //眼底异常信息
    skinState: checkBodyForm.skinState, // 皮肤
    skinStateOthers: checkBodyForm.skinState === '7' ? checkBodyForm.skinStateOthers : null, // 其他皮肤
    cornOpacState: checkBodyForm.cornOpacState, // 巩膜
    cornOpacStateOthers: checkBodyForm.cornOpacState === '4' ? checkBodyForm.cornOpacStateOthers : null, // 其他巩膜
    lympGlanState: checkBodyForm.lympGlanState, // 淋巴结
    lympGlanStateOthers: checkBodyForm.lympGlanState === '4' ? checkBodyForm.lympGlanStateOthers : null, // 其他淋巴结
    barrelChestState: checkBodyForm.barrelChestState, // 肺-桶装肺
    breathSoundState: checkBodyForm.breathSoundState, // 肺-呼吸音
    breathSoundStateAbnormal: checkBodyForm.breathSoundState === '2' ? checkBodyForm.breathSoundStateAbnormal : null, // 呼吸音异常信息
    raleState: checkBodyForm.raleState, // 肺-罗音
    raleStateOthers: checkBodyForm.raleState === '4' ? checkBodyForm.raleStateOthers : null, // 其他罗音
    heartRate: checkBodyForm.heartRate, // 心脏-心率
    rhythmState: checkBodyForm.rhythmState, // 心脏-心律
    murmurState: checkBodyForm.murmurState, // 心脏-杂音
    murmurStateExist: checkBodyForm.murmurState === '2' ? checkBodyForm.murmurStateExist : null, // 杂音信息
    tendernessState: checkBodyForm.tendernessState, // 腹部-压痛
    tendernessStateExist: checkBodyForm.tendernessState === '2' ? checkBodyForm.tendernessStateExist : null, // 压痛信息
    massState: checkBodyForm.massState, // 腹部-包块
    massStateExist: checkBodyForm.massState === '2' ? checkBodyForm.massStateExist : null, // 包块信息
    hapaState: checkBodyForm.hapaState, // 腹部-肝大
    hapaStateExist: checkBodyForm.hapaState === '2' ? checkBodyForm.hapaStateExist : null, //肝大信息
    spleState: checkBodyForm.spleState, //  腹部-脾大
    spleStateExist: checkBodyForm.spleState === '2' ? checkBodyForm.spleStateExist : null, // 脾大信息
    shiftDullState: checkBodyForm.shiftDullState, // 腹部-移动性浊音
    shiftDullStateExist: checkBodyForm.shiftDullState === '2' ? checkBodyForm.shiftDullStateExist : null, // 移动性浊音信息
    edemaExtrState: checkBodyForm.edemaExtrState, // 下肢水肿
    arteState: checkBodyForm.arteState, // 足背动脉搏动
    digtExamState: checkBodyForm.digtExamState, // 肛门指诊
    digtExamStateOthers: checkBodyForm.digtExamState === '5' ? checkBodyForm.digtExamStateOthers : null, // 肛门指诊其他信息
    breast: checkBodyForm.breastCheckboxs?.join('|') || '1', // 乳腺
    breastOthers: checkBodyForm.breastCheckboxs?.indexOf('5') !== -1 ? checkBodyForm.breastOthers : null, // 其他乳腺
    vulvaState: checkBodyForm.vulvaState, // 外阴
    vulvaStateAbnormal: checkBodyForm.vulvaState === '2' ? checkBodyForm.vulvaStateAbnormal : null, // 外阴异常信息
    vaginoState: checkBodyForm.vaginoState, //阴道
    vaginoStateAbnormal: checkBodyForm.vaginoState === '2' ? checkBodyForm.vaginoStateAbnormal : null, // 阴道异常信息
    cervicalState: checkBodyForm.cervicalState, // 宫颈
    cervicalStateAbnormal: checkBodyForm.cervicalState === '2' ? checkBodyForm.cervicalStateAbnormal : null, // 宫颈异常信息
    palaceState: checkBodyForm.palaceState, // 宫体
    palaceStateAbnormal: checkBodyForm.palaceState === '2' ? checkBodyForm.palaceStateAbnormal : null, // 宫体异常信息
    annexaUteriState: checkBodyForm.annexaUteriState, // 附件
    annexaUteriStateAbnormal: checkBodyForm.annexaUteriState === '2' ? checkBodyForm.annexaUteriStateAbnormal : null, // 附件异常信息
    bodyOther: checkBodyForm.bodyOther // 查体其他
  }
})

/**
 * @description: 保存
 * @return {*}
 */
const onSave4 = () => {
  formRef.value &&
    formRef.value.validate((valid: boolean, fields) => {
      if (valid) {
        showSaveLoading.value = true
        const params = {
          ...formDataParams.value,
          checkupStatus: 2, // 已检
          id: checkBodyForm.id, // 表单Id
          checkupRegisterId: props.checkupRegisterId, // 体检登记表id
          dutyDoctorId: checkBodyForm.dutyDoctorId || user.userInfor?.id, // 体检医生id
          dutyDoctorName: checkBodyForm.dutyDoctorId !== user.userInfor?.id ? checkBodyForm.dutyDoctorName || user.userInfor?.userName : user.userInfor?.userName, // 体检医生姓名
          haveWoman: props.gender === '女' ? 1 : 0 // 是否包含妇科 - 0、否， 1、是
        }
        saveCheckBody(params)
          .then(() => {
            getInitData()
            ElMessage.success('保存成功!')
          })
          .catch((err) => {
            showSaveLoading.value = false
            console.warn(err)
          })
      } else {
        console.warn(fields)
      }
    })
}

/**
 * @description: 拒检
 * @return {*}
 */
const onRejectInspection4 = () => {
  showMessageBox('是否对该体检大类进行拒检操作？', {title: '拒检确认', mesageType: 'base'})
    .then(() => {
      showSaveLoading.value = true
      const nullParams: CheckBodyParams = {...formDataParams.value}
      // 置空
      Object.keys(formDataParams.value)?.forEach((item) => {
        nullParams[item] = null
      })
      const params = {
        ...nullParams,
        checkupStatus: 1, // 1拒检
        id: checkBodyForm.id, // 表单Id
        checkupRegisterId: props.checkupRegisterId, // 体检登记表id
        dutyDoctorId: checkBodyForm.dutyDoctorId || user.userInfor?.id, // 体检医生id
        dutyDoctorName: checkBodyForm.dutyDoctorId !== user.userInfor?.id ? checkBodyForm.dutyDoctorName || user.userInfor?.userName : user.userInfor?.userName, // 体检医生姓名
        haveWoman: props.gender === '女' ? 1 : 0 // 是否包含妇科 - 0、否， 1、是
      }
      rejectCheckBody(params)
        .then(() => {
          ElMessage.success('拒检成功!')
          getInitData()
        })
        .catch((error) => {
          showSaveLoading.value = false
          console.warn(error)
        })
    })
    .catch((error) => {
      console.warn(error)
    })
}

/**
 * @description: 乳腺勾选判断
 * @param {*} value
 * @return {*}
 */
const onChangeBreast = (value: string) => {
  if (value === '1') {
    checkBodyForm.breastCheckboxs.length ? (checkBodyForm.breastCheckboxs = ['1']) : (checkBodyForm.breastCheckboxs = [])
  } else {
    checkBodyForm.breastCheckboxs = checkBodyForm.breastCheckboxs.filter((item) => {
      return item !== '1'
    })
  }
}

onMounted(() => {
  getInitData()
})
</script>
<template>
  <el-form ref="formRef" class="d-check-up-desk-content" label-position="top" :model="checkBodyForm" :rules="rules" :disabled="disEdit">
    <el-form-item label="眼底" prop="eyeGroundState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.eyeGroundState">
        <el-radio label="1">
          正常
        </el-radio>
        <el-radio label="2">
          异常
        </el-radio>
      </el-radio-group>
      <el-form-item v-show="checkBodyForm.eyeGroundState === '2'" prop="eyeGroundStateAbnormal">
        <el-input v-model="checkBodyForm.eyeGroundStateAbnormal" clearable />
      </el-form-item>
    </el-form-item>
    <el-form-item label="皮肤" prop="skinState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.skinState">
        <el-radio v-for="item in skinStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
      <el-form-item v-show="checkBodyForm.skinState === '7'" prop="skinStateOthers">
        <el-input v-model="checkBodyForm.skinStateOthers" clearable />
      </el-form-item>
    </el-form-item>
    <el-form-item label="巩膜" prop="cornOpacState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.cornOpacState">
        <el-radio v-for="item in cornOpacStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
      <el-form-item v-show="checkBodyForm.cornOpacState === '4'" prop="cornOpacStateOthers">
        <el-input v-model="checkBodyForm.cornOpacStateOthers" clearable />
      </el-form-item>
    </el-form-item>
    <el-form-item label="淋巴结" prop="lympGlanState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.lympGlanState">
        <el-radio v-for="item in lympGlanStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
      <el-form-item v-show="checkBodyForm.lympGlanState === '4'" prop="lympGlanStateOthers">
        <el-input v-model="checkBodyForm.lympGlanStateOthers" clearable />
      </el-form-item>
    </el-form-item>
    <el-form-item label="肺" class="check-body-form-item">
      <div class="inline-form">
        <el-form-item label="桶状胸:" prop="barrelChestState" class="lung">
          <el-radio-group v-model="checkBodyForm.barrelChestState">
            <el-radio label="1">
              否
            </el-radio>
            <el-radio label="2">
              是
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="呼吸音:" prop="breathSoundState" class="lung">
          <el-radio-group v-model="checkBodyForm.breathSoundState">
            <el-radio label="1">
              正常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.breathSoundState === '2'" prop="breathSoundStateAbnormal">
            <el-input v-model="checkBodyForm.breathSoundStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="罗音:" prop="raleState" class="lung">
          <el-radio-group v-model="checkBodyForm.raleState">
            <el-radio v-for="item in raleStateRadios" :key="item.value" :label="item.value">
              {{ item.label }}
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.raleState === '4'" prop="raleStateOthers">
            <el-input v-model="checkBodyForm.raleStateOthers" clearable />
          </el-form-item>
        </el-form-item>
      </div>
    </el-form-item>
    <el-form-item label="心脏" class="check-body-form-item">
      <div class="inline-form">
        <el-form-item label="心率:" class="heart" prop="heartRate">
          <el-input-number v-model="checkBodyForm.heartRate" :controls="false" :precision="0" :min="10" :max="200" />次/分钟
        </el-form-item>
        <el-form-item label="心律:" prop="rhythmState" class="heart">
          <el-radio-group v-model="checkBodyForm.rhythmState">
            <el-radio label="1">
              齐
            </el-radio>
            <el-radio label="2">
              不齐
            </el-radio>
            <el-radio label="3">
              绝对不齐
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="杂音:" prop="murmurState" class="heart">
          <el-radio-group v-model="checkBodyForm.murmurState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.murmurState === '2'" prop="murmurStateExist">
            <el-input v-model="checkBodyForm.murmurStateExist" clearable />
          </el-form-item>
        </el-form-item>
      </div>
    </el-form-item>
    <el-form-item label="腹部" class="check-body-form-item">
      <div class="inline-form">
        <el-form-item label="压痛:" prop="tendernessState" class="abdomen">
          <el-radio-group v-model="checkBodyForm.tendernessState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.tendernessState === '2'" prop="tendernessStateExist">
            <el-input v-model="checkBodyForm.tendernessStateExist" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="包块:" prop="massState" class="abdomen">
          <el-radio-group v-model="checkBodyForm.massState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.massState === '2'" prop="massStateExist">
            <el-input v-model="checkBodyForm.massStateExist" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="肝大:" prop="hapaState" class="abdomen">
          <el-radio-group v-model="checkBodyForm.hapaState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.hapaState === '2'" prop="hapaStateExist">
            <el-input v-model="checkBodyForm.hapaStateExist" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="脾大:" prop="spleState" class="abdomen">
          <el-radio-group v-model="checkBodyForm.spleState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.spleState === '2'" prop="spleStateExist">
            <el-input v-model="checkBodyForm.spleStateExist" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="移动性浊音:" prop="shiftDullState" class="abdomen">
          <el-radio-group v-model="checkBodyForm.shiftDullState">
            <el-radio label="1">
              无
            </el-radio>
            <el-radio label="2">
              有
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.shiftDullState === '2'" prop="shiftDullStateExist">
            <el-input v-model="checkBodyForm.shiftDullStateExist" clearable />
          </el-form-item>
        </el-form-item>
      </div>
    </el-form-item>
    <el-form-item label="下肢水肿" prop="edemaExtrState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.edemaExtrState">
        <el-radio v-for="item in edemaExtrStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="足背动脉搏动" prop="arteState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.arteState">
        <el-radio v-for="item in arteStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="肛门指诊" prop="digtExamState" class="check-body-form-item">
      <el-radio-group v-model="checkBodyForm.digtExamState">
        <el-radio v-for="item in digtExamStateRadios" :key="item.value" :label="item.value">
          {{ item.label }}
        </el-radio>
      </el-radio-group>
      <el-form-item v-show="checkBodyForm.digtExamState === '5'" prop="digtExamStateOthers">
        <el-input v-model="checkBodyForm.digtExamStateOthers" clearable style="width: 300px" />
      </el-form-item>
    </el-form-item>
    <el-form-item label="乳腺" prop="breastCheckboxs" class="check-body-form-item">
      <el-checkbox-group v-model="checkBodyForm.breastCheckboxs">
        <el-checkbox v-for="item in breastCheckboxs" :key="item.value" :label="item.value" @change="onChangeBreast(item.value + '')">
          {{ item.label }}
        </el-checkbox>
      </el-checkbox-group>
      <el-form-item v-show="checkBodyForm.breastCheckboxs.indexOf('5') !== -1" prop="breastOthers">
        <el-input v-model="checkBodyForm.breastOthers" clearable style="width: 300px" />
      </el-form-item>
    </el-form-item>
    <el-form-item v-if="gender === '女'" label="妇科" class="check-body-form-item">
      <div class="inline-form">
        <el-form-item label="外阴" prop="vulvaState" class="gynaecology">
          <el-radio-group v-model="checkBodyForm.vulvaState">
            <el-radio label="1">
              未见异常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.vulvaState === '2'" prop="vulvaStateAbnormal">
            <el-input v-model="checkBodyForm.vulvaStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="阴道" prop="vaginoState" class="gynaecology">
          <el-radio-group v-model="checkBodyForm.vaginoState">
            <el-radio label="1">
              未见异常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.vaginoState === '2'" prop="vaginoStateAbnormal">
            <el-input v-model="checkBodyForm.vaginoStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="宫颈" prop="cervicalState" class="gynaecology">
          <el-radio-group v-model="checkBodyForm.cervicalState">
            <el-radio label="1">
              未见异常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.cervicalState === '2'" prop="cervicalStateAbnormal">
            <el-input v-model="checkBodyForm.cervicalStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="宫体" prop="palaceState" class="gynaecology">
          <el-radio-group v-model="checkBodyForm.palaceState">
            <el-radio label="1">
              未见异常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.palaceState === '2'" prop="palaceStateAbnormal">
            <el-input v-model="checkBodyForm.palaceStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
        <el-form-item label="附件" prop="annexaUteriState" class="gynaecology">
          <el-radio-group v-model="checkBodyForm.annexaUteriState">
            <el-radio label="1">
              未见异常
            </el-radio>
            <el-radio label="2">
              异常
            </el-radio>
          </el-radio-group>
          <el-form-item v-show="checkBodyForm.annexaUteriState === '2'" prop="annexaUteriStateAbnormal">
            <el-input v-model="checkBodyForm.annexaUteriStateAbnormal" clearable />
          </el-form-item>
        </el-form-item>
      </div>
    </el-form-item>
    <el-form-item label="查体其他" prop="bodyOther" class="check-body-form-item check-body-other">
      <el-input v-model="checkBodyForm.bodyOther" clearable />
    </el-form-item>
  </el-form>
  <div class="d-check-up-desk-footer d-common-flex-center d-common-width-full">
    <span class="doctor">体检医生：</span>
    <el-input v-model="dutyDoctorName4" disabled />
    <el-button type="primary" :loading="showSaveLoading" :disabled="disEdit" @click="onSave4()">
      保存
    </el-button>
    <el-button type="danger" :loading="showSaveLoading" :disabled="(checkupStatus4 && checkupStatus4 === 1) || disEdit" plain @click="onRejectInspection4()">
      拒检
    </el-button>
  </div>
</template>
<style lang="less" scoped>
.check-body-form-item {
  padding-bottom: 15px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(195, 201, 210, 1);
  &:last-child {
    border-bottom: none;
  }
  :deep(.el-form-item__label) {
    color: var(--d-font-color-text);
    font-weight: bold;
    display: inline-flex;
    align-items: center;
  }
  :deep(.el-form-item__content) {
    margin-left: 20px;
  }
}
.inline-input-number-item {
  flex-wrap: nowrap;
  :deep(.el-form-item__label) {
    font-weight: normal;
    margin: 0 !important;
  }
  :deep(.el-form-item__content) {
    margin: 0;
  }
  .el-input-number {
    width: 100px;
    height: 32px;
    margin: 0 5px;
  }
}
.lung {
  .inline-input-number-item();
  .el-radio {
    min-width: 50px;
  }
  :deep(.el-form-item__label) {
    width: 69px;
    justify-content: start;
  }
}
.heart {
  .inline-input-number-item();
  .el-radio {
    min-width: 60px;
  }
}
.abdomen {
  .inline-input-number-item();
  .el-radio {
    min-width: 70px;
  }
  :deep(.el-form-item__label) {
    width: 98px;
    justify-content: start;
  }
}
.gynaecology {
  .inline-input-number-item();
}
.check-body-other {
  width: 100%;
  display: inline-flex;
  :deep(.el-form-item__label) {
    margin: 0 !important;
  }
  .el-input {
    height: 32px;
    width: 300px;
  }
}
.inline-form {
  .heart,
  .abdomen,
  .lung,
  .gynaecology {
    width: 100%;
    display: inline-flex;
    vertical-align: middle;
    margin-right: 30px;
    margin-bottom: 15px;
  }
  .el-input {
    margin-left: 20px;
    height: 32px;
    width: 300px;
  }
}
</style>
